package com.xbongbong.paas.controller.mobile.workflow;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.xbongbong.paas.constant.PaasConstant;
import com.xbongbong.paas.enums.FlowStatusEnum;
import com.xbongbong.paas.enums.NodeTypeEnum;
import com.xbongbong.paas.enums.ProcessTypeEnum;
import com.xbongbong.paas.enums.TaskTypeEnum;
import com.xbongbong.paas.pojo.dto.ProcessTaskDelDTO;
import com.xbongbong.paas.pojo.vo.ProcessNextNodeTaskGetVO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowDetailForListDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeAllReadDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeCheckUpdateRecordDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeTaskCountDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeTaskGetDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeTaskListDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeTaskReadDTO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeCheckUpdateRecordVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskCountVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskGet4IndexVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskGetVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskListVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskRecordsVO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskShowVO;
import com.xbongbong.paas.service.workflow.WorkflowApproveListPageOperationService;
import com.xbongbong.paas.service.workflow.approveListPage.WorkflowApproveListPageService;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.thread.TransmittableThreadLocalUtil;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import com.xbongbong.pro.constant.XbbProConstant;
import com.xbongbong.pro.enums.errorcodes.SystemErrorCodeEnum;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.Objects;

/**
 * 工作流列表页（移动端）
 * @author 魏荣杰
 *
 */
@RestController
@RequestMapping(XbbProConstant.API_ROOT_PREFIX + "/mobile/workflow/approveListPage")
public class MobileWorkflowApproveListPageController {


    @Resource
    private WorkflowApproveListPageOperationService workflowApproveListPageOperationService;
    @Resource
    private WorkflowApproveListPageService workflowApproveListPageService;

    /**
     * Description:
     * @param workflowNodeTaskCountDTO
     * @param br
     * @return java.lang.String
     * @throws
     * @author 魏荣杰
     * @date 2021/6/29 11:00
     * @since
     */
    @RequestMapping(value = "/show", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String show(@RequestBody @Valid WorkflowNodeTaskCountDTO workflowNodeTaskCountDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskShowVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                WorkflowNodeTaskShowVO workflowNodeTaskShowVO = workflowApproveListPageOperationService.show(workflowNodeTaskCountDTO);
                response = new XbbResponse<>(workflowNodeTaskShowVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    /**
     * Description: 工作流 提交给我的，已提交等的数据统计
     * @param workflowNodeTaskCountDTO
	 * @param br
     * @return java.lang.String
     * @throws
     * @author 魏荣杰
     * @date 2021/6/29 13:40
     * @since
     */
    @RequestMapping(value = "/count", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String count(@RequestBody @Valid WorkflowNodeTaskCountDTO workflowNodeTaskCountDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskCountVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                WorkflowNodeTaskCountVO workflowNodeTaskCountVO = workflowApproveListPageOperationService.count(workflowNodeTaskCountDTO);
                response = new XbbResponse<>(workflowNodeTaskCountVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 全部流程任务
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String list(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.ALL.getValue());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.allList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 待我审批的
     */
    @RequestMapping(value = "/todoList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String todoList(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.TODO.getValue());
                workflowNodeTaskListDTO.setNodeType(NodeTypeEnum.PROCESS_NODE.getNodeType());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.todoList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }
    /**
     * 我提交的流程
     */
    @RequestMapping(value = "/createList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String createList(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.CREATE.getValue());
                workflowNodeTaskListDTO.setCreatorId(workflowNodeTaskListDTO.getUserId());
                workflowNodeTaskListDTO.setNodeType(NodeTypeEnum.START_PROCESS_NODE.getNodeType());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.createList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 我已审批的
     */
    @RequestMapping(value = "/haveDoneList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String haveDoneList(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.HAVE_DONE.getValue());
                workflowNodeTaskListDTO.setNodeType(NodeTypeEnum.PROCESS_NODE.getNodeType());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.todoList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 抄送给我的流程
     */
    @RequestMapping(value = "/ccList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String ccList(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.CC.getValue());
                workflowNodeTaskListDTO.setTaskType(TaskTypeEnum.CC.getType());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.ccList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 流程详情，包含流程权限操作,以及表单数据
     */
    @RequestMapping(value = "/detail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String detail(@RequestBody @Valid WorkflowNodeTaskGetDTO workflowNodeTaskGetDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                TransmittableThreadLocalUtil.setValue(workflowNodeTaskGetDTO.getSaasMark(), workflowNodeTaskGetDTO.getBusinessType(), workflowNodeTaskGetDTO.getMenuId(), workflowNodeTaskGetDTO.getDistributorMark());
                WorkflowNodeTaskGetVO workflowNodeTaskGetVO = workflowApproveListPageOperationService.detail(workflowNodeTaskGetDTO);
                response = new XbbResponse<>(workflowNodeTaskGetVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 普通列表页打开流程详情，包含流程权限操作,以及表单数据
     */
    @RequestMapping(value = "/detailForList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String detailForList(@RequestBody @Valid WorkflowDetailForListDTO workflowDetailForListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                TransmittableThreadLocalUtil.setValue(workflowDetailForListDTO.getSaasMark(), workflowDetailForListDTO.getBusinessType(), workflowDetailForListDTO.getMenuId(), workflowDetailForListDTO.getDistributorMark());
                WorkflowNodeTaskGetVO workflowNodeTaskGetVO = workflowApproveListPageOperationService.detailForList(workflowDetailForListDTO);
                response = new XbbResponse<>(workflowNodeTaskGetVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 审批记录和抄送人列表
     */
    @RequestMapping(value = "/records", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String records(@RequestBody @Valid WorkflowNodeTaskGetDTO workflowNodeTaskGetDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskRecordsVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                WorkflowNodeTaskRecordsVO workflowNodeTaskRecordsVO = workflowApproveListPageOperationService.records(workflowNodeTaskGetDTO);
                response = new XbbResponse<>(workflowNodeTaskRecordsVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 首页我提交的流程
     */
    @RequestMapping(value = "/index/createList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String createListForIndex(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.CREATE.getValue());
                workflowNodeTaskListDTO.setCreatorId(workflowNodeTaskListDTO.getUserId());
                if (null == workflowNodeTaskListDTO.getPageSize()){
                    workflowNodeTaskListDTO.setPageSize(PaasConstant.APPROVAL_INDEX_SIZE);
                }
                workflowNodeTaskListDTO.setNodeType(NodeTypeEnum.START_PROCESS_NODE.getNodeType());
                workflowNodeTaskListDTO.setFlowStatusIn(Arrays.asList(FlowStatusEnum.IN_APPROVAL.getType(), FlowStatusEnum.APPROVAL_PENDING.getType()));
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.createList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    /**
     * 首页提交给我的流程
     */
    @RequestMapping(value = "/index/todoList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String todoListForIndex(@RequestBody @Valid WorkflowNodeTaskListDTO workflowNodeTaskListDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskListVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                workflowNodeTaskListDTO.setProcessType(ProcessTypeEnum.TODO.getValue());
                if (null == workflowNodeTaskListDTO.getPageSize()){
                    workflowNodeTaskListDTO.setPageSize(PaasConstant.APPROVAL_INDEX_SIZE);
                }
                workflowNodeTaskListDTO.setNodeType(NodeTypeEnum.PROCESS_NODE.getNodeType());
                workflowNodeTaskListDTO.setTaskType(TaskTypeEnum.UNTREATED.getType());
                WorkflowNodeTaskListVO workflowNodeTaskListVO = workflowApproveListPageService.todoList(workflowNodeTaskListDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    @RequestMapping(value = "/readNode", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String readNode(@RequestBody @Valid WorkflowNodeTaskReadDTO workflowNodeTaskReadDTO, BindingResult br) {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {

            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                BaseVO baseVO = workflowApproveListPageOperationService.readNode(workflowNodeTaskReadDTO);
                response = new XbbResponse<>(baseVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    @RequestMapping(value = "/delTask", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String delTask(@RequestBody @Valid ProcessTaskDelDTO processTaskDelDTO, BindingResult br) {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                BaseVO baseVO = workflowApproveListPageOperationService.delTask(processTaskDelDTO);
                response = new XbbResponse<>(baseVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 审批抄送消息一键已读
     */
    @RequestMapping(value = "/readAllCcList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String readAllCcList(@RequestBody @Valid WorkflowNodeAllReadDTO workflowNodeAllReadDTO, BindingResult br) {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                BaseVO baseVO = workflowApproveListPageOperationService.readAllCcList(workflowNodeAllReadDTO);
                response = new XbbResponse<>(baseVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 首页审批详情
     * @param workflowNodeTaskGetDTO
     * @param br
     * @return
     */
    @RequestMapping(value = "/index/detail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String readAllCcList(@RequestBody @Valid WorkflowNodeTaskGetDTO workflowNodeTaskGetDTO, BindingResult br) {
        XbbResponse<WorkflowNodeTaskGet4IndexVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                WorkflowNodeTaskGet4IndexVO workflowNodeTaskGet4IndexVO = workflowApproveListPageOperationService.detail4Index(workflowNodeTaskGetDTO);
                response = new XbbResponse<>(workflowNodeTaskGet4IndexVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 获取下一个节点的信息
     */
    @RequestMapping(value = "/nextNode", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String nextNode(@RequestBody @Valid WorkflowNodeTaskGetDTO taskGetDTO, BindingResult br) {
        XbbResponse<ProcessNextNodeTaskGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                ProcessNextNodeTaskGetVO workflowNodeTaskListVO = workflowApproveListPageOperationService.nextNode(taskGetDTO);
                response = new XbbResponse<>(workflowNodeTaskListVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     *
     * @Description: 审批详情页，查看更新记录
     * @param workflowNodeCheckUpdateRecordDTO
     * @param br
     * @return: java.lang.String
     * @Author: shen.yang
     * @Date: 2022/9/27  9:11
    */
    @RequestMapping(value = "/checkUpdateRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String checkUpdateRecord(@RequestBody @Valid WorkflowNodeCheckUpdateRecordDTO workflowNodeCheckUpdateRecordDTO, BindingResult br) {
        XbbResponse<WorkflowNodeCheckUpdateRecordVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                WorkflowNodeCheckUpdateRecordVO workflowNodeCheckUpdateRecordVO = workflowApproveListPageOperationService.checkUpdateRecord(workflowNodeCheckUpdateRecordDTO);
                response = new XbbResponse<>(workflowNodeCheckUpdateRecordVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

}
